package com.tuyrt.firstcode.kotlin.basic

/**
 * Created by tuyrt7 on 2021/4/12.
 * infix 植入
 */

infix fun String.beginWith(prefix: String) = startsWith(prefix)

// "first" to 1
infix fun <A, B> A.with(that: B): Pair<A, B> = Pair(this, that)


fun main() {
    if ("hello world" beginWith "he") {
        println("hello world beginWith is true")
    }

    val map = mapOf("Apple" with "苹果", "orange" with "橘子")
    println("Apple is: ${map["Apple"]}")
}